<HTML><HEAD><TITLE>plus(?Add1, ?Add2, ?Sum)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Arithmetic</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>plus(?Add1, ?Add2, ?Sum)</H1>
Succeeds if Sum is the sum of integer arguments Add1 and Add2.


<DL>
<DT><EM>Add1</EM></DT>
<DD>an integer or a variable
</DD>
<DT><EM>Add2</EM></DT>
<DD>an integer or a variable
</DD>
<DT><EM>Sum</EM></DT>
<DD>an integer or a variable
</DD>
</DL>
<H2>Description</H2>
   Defines the arithmetic relation Add1 + Add2 = Sum.  If all arguments are
   instantiated plus/3 succeeds if this relation holds.  If one of the
   arguments is uninstantiated, it is bound to an integer such that the
   relation holds.  If the system is in coroutining mode and more than one
   argument is uninstantiated, plus/3 delays until at least two of the
   arguments are known.

<P>

<H3>Modes and Determinism</H3><UL>
<LI>plus(+, +, -) is det
<LI>plus(+, -, +) is det
<LI>plus(-, +, +) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(5) type error </EM>
<DD>an argument is neither an integer nor a variable
<DT><EM>(4) instantiation fault </EM>
<DD>more than one argument is uninstantiated (non-coroutining    mode only)
</DL>
<H2>Examples</H2>
<PRE>
   Success:
   plus(1, 2, 3).
   plus(3, 4, Z).                   (gives Z=7)
   plus(X, 4, 7).                   (gives X=3)
   plus(3, Y, 7).                   (gives Y=4)
   Fail:
   plus(3, 4, 5).
   Error:
   plus(3.0, 4.0, 7.0).             (error 5)
   plus(2 + 3, 1, 6).               (error 5)
   plus(X, 1, Z).                   (error 4)



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/arithmetic/times-3.html">times / 3</A>
</BODY></HTML>
